import Mock from 'mockjs'

export default {
  getMenu: config => {
    const { username, password } = JSON.parse(config.body);
    if (username === 'luke' && password === 'lgj') {
      return {
        code: 2000,
        data: {
          menu: [
            {
              path: '/',
              name: 'Index',
              meta: { title: '首页', icon: 'house' }
            },
            {
              path: '/user',
              name: 'User',
              meta: { title: '用户管理', icon: 'User' }
            },
            {
              path: '/room',
              name: 'Room',
              meta: { title: '房间管理', icon: 'Lock' }
            },
            {
              path: '/device',
              name: 'Device',
              meta: { title: '设备管理', icon: 'Box' },
              children: [
                {
                  path: '/device/hard',
                  name: 'Hard',
                  meta: { title: '固定资产', icon: 'Cpu' },
                },
                {
                  path: '/device/soft',
                  name: 'Soft',
                  meta: { title: '软件资产', icon: 'Document' },
                },
              ]
            },
          ],
          token: Mock.Random.guid()
        }
      }
    } else if (username === 'admin' && password === 'admin') {
      return {
        code: 2000,
        data: {
          menu: [
            {
              path: '/',
              name: 'Index',
              meta: { title: '首页', icon: 'house' }
            },
            {
              path: '/device',
              name: 'Device',
              meta: { title: '设备管理', icon: 'Box' },
              children: [
                {
                  path: '/device/hard',
                  name: 'Hard',
                  meta: { title: '固定资产', icon: 'Cpu' },
                },
                {
                  path: '/device/soft',
                  name: 'Soft',
                  meta: { title: '软件资产', icon: 'Document' },
                },
              ]
            },
          ],
          token: Mock.Random.guid()
        }
      }
    }
  }
}